<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"  
      xmlns:h="http://java.sun.com/jsf/html"  
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Comment On Article Member </title>
    </h:head>
    <body>
        <h:form id="articleForm" >
            <p:dataTable styleClass="sample" id="table" value="#{articleBean.articles}" var="art">
                <f:facet name="header">
                    <h:outputText value="Articles" />
                </f:facet>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="Id" />
                    </f:facet>
                    <h:outputText value="#{art.id}" />
                </p:column>
                <h:selectOneRadio id="status" value="#{art.status}" 
                                  title="Please choose a status" layout="pageDirection" border="1">
                    <f:selectItem id="ut1"   itemLabel="Draft" itemValue="Draft" />
                    <f:selectItem id="ut2"  itemLabel="Published" itemValue="Published" />
                </h:selectOneRadio>

                <p:column>
                    <f:facet name="header">
                        <h:outputText value="Date of publication" />
                    </f:facet>
                    <h:outputText value="#{art.date}" />
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="Title" />
                    </f:facet>
                    <h:outputText value="#{art.title}" />
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="Image" />
                    </f:facet>
                    <h:outputText value="#{art.image}" />
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="Article Text" />
                    </f:facet>
                    <h:outputText value="#{art.articleBody}" />
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="Select Action" />
                    </f:facet>
                    <h:panelGrid columns="3" styleClass="actions" cellpadding="2">  
                        <p:commandButton id="commentOnArticle" update="commentForm" oncomplete="dCommentOnPage.show()"  value="Comment" >  
                            <f:setPropertyActionListener value="#{art.id}" target="#{commentBean.artI}" />  
                        </p:commandButton>  
                    </h:panelGrid>  
                </p:column>                          
            </p:dataTable>
            <br/>
            <p:commandButton  update="articleForm" actionListener="#{articleBean.retrieveArticles()}" value="Show Articles"/> 
            <br/>
        </h:form>
    </body>
</html>
